﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using DataAccess.ArchivesTableAdapters;
using DataAccess;
using System.Data;

namespace BusinessLogic
{
    [DataObject]
    public class DepartmentBO
    {
        private tblDepartmentsTableAdapter DepartmentAdapter = null;
        protected tblDepartmentsTableAdapter Adapter
        {
            get
            {
                if (DepartmentAdapter == null)
                {
                    DepartmentAdapter = new tblDepartmentsTableAdapter();
                }
                return DepartmentAdapter;
            }
        }

        [DataObjectMethodAttribute(DataObjectMethodType.Select, true)]
        public Archives.tblDepartmentsDataTable GetAllDepartments()
        {
            return Adapter.GetAllDepartments();
        }

        [DataObjectMethodAttribute(DataObjectMethodType.Select, false)]
        public DataTable GetByID(int depID)
        {
            return Adapter.GetByID(depID);
        }

        [DataObjectMethodAttribute(DataObjectMethodType.Delete, true)]
        public int DeleteDepartment(int depID)
        {
            return Adapter.DeleteDepartment(depID);
        }

        [DataObjectMethodAttribute(DataObjectMethodType.Insert, true)]
        public int InsertDepartment(string depName, string depCode)
        {
            return Adapter.AddNewDepartment(depName, depCode);
        }

        [DataObjectMethodAttribute(DataObjectMethodType.Update, true)]
        public int UpdateDepartment(string depName, string depCode, int depID)
        {
            return Adapter.UpdateDepartment(depName, depCode, depID);
        }
    }
}
